package com.yi.service.impl;

import java.util.List;

import javax.inject.Inject;

import org.konghao.basic.model.Pager;
import org.springframework.stereotype.Service;

import com.yi.service.IStudentService;
import com.yi.student.dao.IStudentDao;
import com.yi.student.model.Student;
@Service("studentService")
public class StudentServiceImpl implements IStudentService {

	
	private IStudentDao studentDao ;
	
	public IStudentDao getStudentDao() {
		return studentDao;
	}

	@Inject
	public void setStudentDao(IStudentDao studentDao) {
		this.studentDao = studentDao;
	}

	@Override
	public void addStudent(Student stu) {

		studentDao.add(stu);
	}

	@Override
	public void addStudents(List<Student> stus) {

		studentDao.addUsers(stus);
	}

	@Override
	public List<Student> listPunishs(Integer year , String sesemath ) {

		
		return studentDao.listRewardStudents(year, sesemath);
	}

	@Override
	public List<Student> listRewards(Integer year , String sesemath) {
		
		return studentDao.listPunishStudents(year, sesemath);
	}

	@Override
	public Pager<Student> page() {
		return studentDao.find("from Student");
	}

	@Override
	public void deleteStudent(int uid) {

		studentDao.delete(uid);
	}

	@Override
	public boolean stuExit(String xh) {
		return studentDao.checkStuExits(xh);
	}

	@Override
	public void updateStudent(Student stu) {

		studentDao.update(stu);
	}

	@Override
	public Student loadStuById(int uid) {
		Student stu = studentDao.load(uid);
		return stu;
	}

	@Override
	public Student loadStudentByXh(String xh) {
		return studentDao.findStudentByXh(xh);
	}
	
	

}
